package stu.khy.service.impl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import stu.khy.dao.EmployeeDao;
import stu.khy.entity.Employee;
import stu.khy.service.EmployeeService;
@Service
public class EmployeeServiceImpl implements EmployeeService{
	@Resource
    private EmployeeDao employeeDao;
	@Override
	public Employee loginEmp(String name,String password) {
		Employee emp=employeeDao.loginEmp(name);
		if(emp.getPassword().equals(password)) {
			return emp;
		}
		return null;
	}
	
	@Override
	public boolean registerEmp(Employee employee) {
		// TODO Auto-generated method stub
		return employeeDao.registerEmp(employee)>0?true:false;
	}

	@Override
	public Employee findEmpBySn(String sn) {
		Employee employee=employeeDao.findEmpBySn(sn);
	    if(employee==null) {
	    	return null;
	    }
		return employee;
	}

	@Override
	public Employee getManager(Employee employee) {
		return employeeDao.getManager(employee);
	}




}
